<template>
  <div class="app">
    <div class="btns">
        <span @click="rushBuy">正在抢购</span> <span @click="update">上新预告</span>
    </div>
    <div class="box">
        <div class="list" v-for="(item,index) in listArr " :key="index">
            <img :src="item.picture" alt="">
        <div>
            <h3>{{item.name}}</h3>
            <div class="btn">
               <span> 爆爆团价：￥{{item.min_price}}</span> 
               <button @click="btn(item,index)">{{item.status==0?"马上抢":"已抢"}}</button>
            </div>
            <div class="num">
                <span>{{item.month_saled_content}}</span>
            </div>
        </div>
    </div>
        </div>
   
  </div>
</template>

<script>
import {tuan_list} from "../Utils/api"
export default {
    data(){
        return {
            currentIndex:0,
            listArr:[],
            updateArr:[]
        }
    },
    mounted(){
        tuan_list({status:0}).then((res)=>{
            this.listArr=res.data.list
        }) 
    }
    ,
    methods:{
        btn(item,index){
            item.status=2
    },
    update(){
        tuan_list({status:1}).then((res)=>{
            this.listArr=res.data.list
        }) 
    },
    rushBuy(){
        tuan_list({status:0}).then((res)=>{
            this.listArr=res.data.list
        }) 
    }
    },
   
   
}
</script>

<style lang="scss" scoped>
.box{
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    position: fixed;
    margin-bottom: 60px;
    padding: 10px;
    box-sizing: border-box;
}
.list{
    width: 100%;
    background-color: white;
    border-radius: 5px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    margin-bottom: 10px;
}
.list p{
    font-size: 12px;
    color: gray;
}
.list h3{
    font-size: 16px;
}
img{
    width: 90px;
    height:90px;
    margin-right: 10px;
}
.btn,.num{
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
}
.btn span{
    display: inline-block;
    color: red;
}
.btn button{
   width: 70px;
   height: 30px;
   position: fixed;
   right: 20px;
   background-color: red;
   color: white;
   border: none;
   border-radius: 15px;
   
}
.num span:first-child{
color: grey;
font-size: 12px;
}
.num span:last-child{
    color: red;
    font-size: 12px;
}
.btns{
    width: 100%;
    background-color: orangered;
}
.btns span{
color: white;
margin-right: 30px;
font-size: 16px;
text-align: left;
}
</style>